<?php
require_once dirname(__FILE__).'/../model/SuperManagerModel.class.php';

class SuperManagerController{
	
	//查看所有管理员
	public function allManagersShow(){
		$superManagerModel = new SuperManagerModel();
		//var_dump($superManagerModel->allManagersShow());
		//die("!!!!!");
		return $superManagerModel->allManagersShow();
	}
	
	//删除管理员
	public function deleteManager($courseOrStudentId){
		$superManagerModel = new SuperManagerModel();
		$superManagerModel->deleteManager($courseOrStudentId);
	}
	
	//显示待审核管理员信息
	public function showAllCanAllowManagers(){
		$superManagerModel = new SuperManagerModel();
		$showAllCanAllowManagers = $superManagerModel->showAllCanAllowManagers();
		return $showAllCanAllowManagers;
	}
	
	//通过审核
	public function AllowManager($courseOrStudentId){
		$superManagerModel = new SuperManagerModel();
		$superManagerModel->AllowManager($courseOrStudentId);
	}
	
}
	//审核
	$operation = isset($_GET['operation']) ? $_GET['operation'] : "";
	$object = isset($_GET['object']) ? $_GET['object'] : "";
	$courseOrStudentId = isset($_GET['courseOrStudentId']) ? $_GET['courseOrStudentId']: "";
	
	$superManagerController = new SuperManagerController();
	//通过审核
	if($operation === 'canallow' && $object === 'manager'){
		//通过
		$superManagerController->AllowManager($courseOrStudentId);
		//回到主界面
		header("Location:http://localhost/SelectCoursesSystem/view/manager/SuperManagerView.php");
	}
?>